@import '../../variable';

.table {

}

:global {

  /* 表格 */

  .ant-table-wrapper {
    // 表头居中
    &.head-center {
      tr > th {
        text-align: center !important;
      }
    }

    //&.with-border {
    //  border: 1px solid @border-color-base;
    //
    //  .ant-table-container {
    //    border: 0 !important;
    //  }
    //}

    td.ant-table-column-sort {
      background: #fff;
    }

    .ant-table-thead > tr > th {
      font-weight: 600;
      border-top: 1px solid @border-color-base;
    }

    .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
      word-break: break-all;
    }

    &.inner {

      .ant-table-small.ant-table-bordered, .ant-table-bordered .ant-table-fixed-right, .ant-table-bordered .ant-table-content {
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
      }

      .ant-table-bordered .ant-table-footer {
        border-radius: 0;
        border: 0;
      }
    }

    .ant-table.ant-table-bordered {

      .ant-table-thead > tr > th {
        border-top: 0;
      }

      .ant-table-container {
        border-right: 1px solid @border-color-base;
        border-bottom: 1px solid @border-color-base;
      }
    }
  }

  /* 表头 可调整列宽 start */

  thead > tr > th {
    //text-align: center !important;

    &.react-resizable {
      position: relative;
      transition: none !important;
      user-select: none;
    }

    .react-resizable-handle {

      &.react-resizable-handle-w, &.react-resizable-handle-e {
        box-sizing: content-box;
        position: absolute;
        width: 2px;
        height: 100%;
        top: 0;
        bottom: 0;
        transform: none;
        padding: 0;
        margin: 0;
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        cursor: col-resize;
        z-index: 1;
        background-color: transparent;
        background-image: none;

        &:hover, &:active {

          &::before {
            content: "";
            display: block;
            position: absolute;
            right: -4px;
            width: 10px;
            height: 100%;
            background: rgba(0, 0, 0, 0.06);
            pointer-events: none;
            touch-action: none;
          }
        }
      }

      /* 右侧 */

      &.react-resizable-handle-e {
        left: auto;
        right: -6px;

        &:hover, &:active {
          border-left-width: 30px;
          border-right-width: 5px;
        }
      }

      /* 左侧 */

      &.react-resizable-handle-w {
        left: -6px;
        right: auto;

        &:hover, &:active {
          border-left-width: 5px;
          border-right-width: 30px;
        }
      }

    }
  }

  /* 表头 可调整列宽 end */

  /* 可编辑表格 start */

  .no-padding {

    .ant-table-tbody > tr.ant-table-row.active {
      &, > td {
        background: @bg-table-active; //rgb(242, 251, 255) !important;
      }
    }

    .ant-table-tbody > tr > td, tfoot > tr > td, tfoot > tr > th {
      padding: 0 4px !important;
      word-break: break-all;
      height: 32px;

      &.active {
        background: @bg-cell-active !important;
        cursor: pointer;
      }

      &.error {
        //background: @bg-cell-active !important;
        //cursor: pointer;
        border-bottom: 2px solid red;
      }
    }

    .ant-table-footer {
      padding: 0 !important;
    }

    .ant-form-explain {
      position: absolute;
      top: 3px;
      right: 0;
      padding-right: 6px;
      font-size: 12px;
      text-align: right;
    }

    .ant-table-body {

      .ant-select, .ant-input {
        display: block;
      }

      .ant-form-item-control-input {
        min-height: 30px;
      }

      .ant-select-selection, .ant-input, .ant-input-number-input {
        height: 30px;
      }

      .ant-input {
        padding-left: 6px;
        padding-right: 6px;
      }

      .ant-input-affix-wrapper {
        height: 32px;

        .ant-select-selection, .ant-input, .ant-input-number-input {
          height: auto;
        }

        .ant-input {
          padding: 0;
          border: none;
          outline: none;
        }
      }

    }

  }

  /* 可编辑表格 end */


  /* popover 里的 table */
  //.ant-popover.in-table {
  //  margin-left: -10px;
  //  margin-right: -10px;
  //
  //  //.ant-popover-inner {
  //  //  background-color: rgba(0, 0, 0, 0.6);
  //  //}
  //
  //  .ant-popover-inner-content {
  //    padding: 0
  //  }
  //}

  /* end popover */

  // 必要原子类
  .t-c-left {
    text-align: left;
  }

  .t-c-right {
    text-align: right;
  }

  .t-c-center {
    text-align: center;
  }

}
